package com.fiap.controleLancamentos.dao;
import java.io.FileNotFoundException;
import java.sql.*;

import com.fiap.controleLancamentos.util.Diretorio;
public class Dao {

	protected Connection conexaoDB;
	protected PreparedStatement st;
	protected ResultSet rs;
	protected String erro;
	
	protected boolean abreConexao() throws SQLException, ClassNotFoundException{
		try{
			
			Diretorio.criar("C:/BANCOAPP/", "");
			Class.forName("org.sqlite.JDBC");
			conexaoDB = DriverManager.getConnection("jdbc:sqlite:c:\\bancoapp\\controleLancamentos.db");
			return true;
		}
		catch(SQLException ex){
			throw ex;
		} catch (ClassNotFoundException ex2) {
			throw ex2;
		}
	}
	
	protected void fechaConexao() throws Exception{
		conexaoDB.close();
	}
}
